package com.foreknow.demo6;

public class TestParking {
    public static void main(String[] args) {
        park(new MinBus());
        park(new BigBus());
        park(new BigBus());
        park(new MinBus());
    }
    //参数多态
    public static void park(Bus b){
        int money = b.payParkingFee();
        System.out.println(money);
    }
}
class Bus{
    public int payParkingFee(){
        return 0;
    }
}
class MinBus extends Bus{
    @Override
    public int payParkingFee(){
        return 5;
    }
}
class BigBus extends Bus{
    @Override
    public int payParkingFee(){
        return 10;
    }
}